07. Lesson Review
In this lesson we learned…
One of the best ways of developing an application quickly is to reuse code. This lesson focused a lot on a couple of the scripts that was provided in the course and project assets.
The goal of this lesson was not to teach you all the specifics of each script, but to get you comfortable looking at another’s code to see how you can use and adapt it to suit your needs.
This will be a vital skill as you progress though your development career. Getting assets from the Unity asset store, for example, may require you to look at their documentation, if they have any, and experiment with what they’ve created. Not all assets are going to have tutorials provided, so you have to be willing to spend some time looking at examples, and experimenting to learn new skills.
Udacity Teleportation Script Example
In our experiment, we brought a prefab into the scene. This let us explore the components on the prefab to get a better idea of how it worked.
The Waypoints prefab has a script on it called Navigation. Looking at the script, we can see some helpful comments that give us hints and explanations about how things work and what they do. This script is responsible for moving the camera
It also has several child game objects which are individual waypoints. Each of those have a Waypoint script attached. The waypoint script has a variety of properties that affect the individual waypoint.
Udacity Ocean Shader Example
We learned that the Ocean shader is attached to a Scene Setup script which is attached to Scene gameobject. The ocean is dynamically generated at runtime, so when we aren’t in play mode, the ocean won’t show up.
When we look at the Ocean shader, we can see all of the properties that we can change. We could opt to change values directly in the shader, but most shaders expose their most important properties publicly. We’re opting to change those in the inspector rather than editing the shader.
Udacity Flocking Example
In this example, we edited a script to suit our needs. We wanted to change the object that was flocking, so we edited a property. We got several errors in our console. By reading the error, we learned that we were missing a mesh renderer because there wasn’t one on our objects. We commented out the lines that mentioned mesh renderer, and running it again, worked.